package controller

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type IDRequest struct {
	ID uint
}

type Response struct {
	Code uint   `json:"code"`
	Msg  string `json:"msg"`
	Data any    `json:"data"`
}

func SendError(c *gin.Context, err error) {
	var response Response
	response.Code = 50000
	response.Msg = err.Error()
	c.JSON(http.StatusOK, response)
}

func SendData(c *gin.Context, data any) {
	var response Response
	response.Code = 20000
	response.Data = data
	c.JSON(http.StatusOK, response)
}

func SendOK(c *gin.Context) {
	var response Response
	response.Code = 20000
	response.Data = nil
	c.JSON(http.StatusOK, response)
}
